<include file="Public:head" />
<script src="__PUBLIC__/js/jquery/validate.js"></script>
<script type="text/javascript">
    $(function(){
//        jQuery.validator.addMethod("checkUsername", function(value, element) {  
//            var name = $("#name").val();
//            var pattern = /^[\w\u4e00-\u9fa5]+$/gi;
//            if(pattern.test(name))
//            {
//                return true;
//            }else{
//                return false;
//            }     
//        }); 	
        $("#form_reg").validate({
            errorPlacement: function(error, element){
                var error_td = element.parent('li');
                error_td.find('label.error').hide();
                error_td.append(error);
               
            },
            rules : {
                name : {
                    required : true,
                    minlength: 3,
                    remote   : {
                        url :"{:U('Ajax/checkName')}",
                        type:'post',
                        data:{
                            name : function(){
                                return $("input[name=name]").val();
                            }
                        }
                    }
                },
                password : {
                    required : true,
                    minlength: 6
                },
                password_confirm : {
                    required : true,
                    equalTo  : '#password'
                },
                email : {
                    required : true,
                    email    : true,
                    remote   : {
                        url : "{:U('Ajax/checkEmail')}",
                        type: 'post',
                        data:{
                            email : function(){
                                return $("input[name=email]").val();
                            }
                        }
                    }
                }
                
            },
            messages : {
                name : {
                    required : '用户名不能为空',
                    minlength:  '用户名必须在3-15个字符之间',
                    remote	 : '该用户名已经存在'
                },
                password  : {
                    required : '密码不能为空',
                    minlength: '密码长度应在6-15个字符之间'
                },
                password_confirm : {
                    required : '请再次输入您的密码',
                    equalTo  : '两次输入的密码不一致'
                },
                email : {
                    required : '电子邮箱不能为空',
                    email    : '这不是一个有效的电子邮箱',
                    remote	 : '该电子邮箱已经存在'
                }
                
            }
        });
    });
    function loginArea2(){
        goHide('#area_reg');
        goShow('#area_login');
        $("#regArea").prop("checked",false);
    }
    function regArea2(){
        goHide('#area_login');
        goShow('#area_reg');
        $("#loginArea").prop("checked",false);
    }
</script>
<div id="wrap">
    <!--end of header-->
    <div id="container">
        <div class="acc_bind shadow">   
            <p>您好，您已经用{$Think.session.type}账号成功登陆{$config.title}。</p>
            <form id="form_login" method="POST" action="{:U('Login/login')}" onsubmit="return form_login()"> 
                <ul class="bind_reg clearfix">
                    <li class="br4">
                        <label><input type="radio" autocomplete="off"  value="0" id="loginArea"  name="bind" onclick="loginArea2()"/>
                            已经注册过{$config.title}
                        </label>
                        <div class="has_account" style="display:none" id="area_login">
                            <ul class="bind_login">
                                <li><label>账号：</label><input name="name" value="{$Think.session.threeName}" type="text"autocomplete="off" maxlength="15" /></li>
                               
                                <li><label>密码：</label><input name="pwd" type="password"  autocomplete="off" maxlength="15"/></li>
                                <li><label>&nbsp</label><input type="submit" value="绑定" id="bindAccount"/></li>
                             
                            </ul>
                        </div>
                    </li>
                </ul>
            </form>
            <form id="form_reg"  name="form_reg" method="post" action="{:U('Reg/reg_post')}" class="common-form" >
                <ul class="bind_reg clearfix">
                    <li class="br4 clearfix">
                        <label>
                            <input type="radio" checked="checked" autocomplete="off" name="bind" value="1" id="regArea" onclick="regArea2()"/>
                            还没有注册过{$config.title}（注册{$config.title}账户）
                        </label>
                        <div class="has_account" id="area_reg">
                            <ul class="bind_login">
                                <li><label>账号：</label><input name="name" id="name" value="{$Think.session.threeName}" type="text" autocomplete="off" maxlength="15"/></li>
                                <li><label>密码：</label><input name="password" type="password" id="password" autocomplete="off" maxlength="15"/></li>
                                <li><label>确认密码：</label><input name="password_confirm" type="password"  autocomplete="off" maxlength="15"/></li>
                                  <li><label>邮箱：</label><input name="email" type="text" id="email" autocomplete="off" maxlength="150"/></li>
                                <li><label>&nbsp</label><input type="submit" value="创建" id="createAccount"/></li>
                            </ul>
                        </div>
                    </li>
                </ul>
            </form>
        </div>
    </div>
</div>
<include file="Public:foot" />